package com.chapter17;

import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import javax.swing.JTextField;

public class AutoSelect implements FocusListener
  {
   public void focusGained (FocusEvent e)
	 {
	  if (e.getComponent() instanceof JTextField)
		{
		 JTextField t = (JTextField) e.getComponent();
		 t.selectAll();
		}
	 }

   public void focusLost (FocusEvent e)
	 {
	 }
  }